package com.blits.listview;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        //ambil id di layout
        ListView listView = (ListView) findViewById(R.id.listView1);
        
        //kemudian kita buat datanya berupa array
        String[] data = new String[]{"Andi","Yulistyo","Sanriomi", "Ferdi","Idris","Endar"};
        
        
        //masukkan data ke adapter
        ArrayAdapter<String> adap = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, data);
        
        
        
        //sekarang kita set ada adapter
        listView.setAdapter(adap);
        
        
        
        
        
        
        
        
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}
